<?php
class Workkind extends AppModel {
	var $name = 'Workkind';
	var $useTable = 'sys_params_mst';
	
	
	function init()
	{
		$rs=$this->findAll("kbn='tema_id'");
		return $rs;
	
	}
	function dosave($data)
	{
		
		$data['Workkind']['kbn']='tema_id';
		$data['Workkind']['id']=$this->getMaxId()+1;
		return $this->save($data);
	}
	function doDelete($id)
	{
//		$p=$data['Workkind']['id'];
//		$str=implode(',',$p);
		return $this->mydelete($id);
		
	}
	function mydelete($id)
	{
		$sql="delete from sys_params_mst where kbn='tema_id' and id in ($id)";
		$p=$this->query($sql);
			
	}
   function getMaxId(){
   	$sql="SELECT MAX(id) AS val FROM ".$this->useTable." WHERE kbn='tema_id'";
   	$rs=$this->query($sql);
   	return $rs[0][0]['val']; 
   }
}
?>